/**
 * 
 */
package cz.cuni.mff.abacs.burglar.logics.objects.agents;

import cz.cuni.mff.abacs.burglar.logics.DataMap;
import cz.cuni.mff.abacs.burglar.logics.objects.BaseInterface;
import cz.cuni.mff.abacs.burglar.logics.objects.BaseObject;
import cz.cuni.mff.abacs.burglar.logics.objects.Room;
import cz.cuni.mff.abacs.burglar.logics.objects.positions.Position;


/** 
 * The protagonist of the game.
 * 
 * @author abacs
 *
 */
public class Burglar extends BaseAgent implements Agent {
	
	
	// -------------------------------------------------------------------------
	// constructors:
	
	
	/**
	 * 
	 * 
	 * @param id
	 * @param position
	 * @param aim
	 * @param itemIdToCollect
	 */
	public Burglar(
			int id,
			Position position,
			Room aim,
			int itemIdToCollect,
			DataMap referenceMap
	) {
		super(
				id,
				BaseObject.Type.BURGLAR,
				position, 
				new BurglarGoal(aim.getId(), itemIdToCollect),
				referenceMap
		);
	}
	
	
	/**
	 * 
	 * @param original
	 * @param referenceMap
	 */
	protected Burglar(Burglar original, DataMap referenceMap) {
		super(original, referenceMap);
	}
	
	
	// -------------------------------------------------------------------------
	
	
	/**
	 * 
	 * @param roomId
	 */
	public void setAimId(int roomId) {
		((BurglarGoal)(this._goals)).setAimId(roomId);
	}	
	
	
	/**
	 * 
	 * @return
	 */
	public int getAimId() {
		return ((BurglarGoal)(this._goals)).getAimId();
	}
	
	
	/**
	 * 
	 * @param itemId
	 */
	public void setItemIdToCollect(int itemId) {
		((BurglarGoal)(this._goals)).setItemIdToCollect(itemId);
	}
	
	
	/**
	 * 
	 * @return
	 */
	public int getItemIdToCollect() {
		return ((BurglarGoal)(this._goals)).getItemIdToCollect();
	}
	
	
	// -------------------------------------------------------------------------
	
	/**
	 * 
	 */
	public boolean isSatisfied() {
		return this._goals.isSatisfied(this);
	}
	
	
	// -------------------------------------------------------------------------
	
	
	@Override
	public void copyChangeables(Agent original) {
		
		assert(original.isTypeOf(BaseInterface.Type.BURGLAR));
		
		super.copyChangeables((BaseAgent)original);
	}
	
	
	@Override
	public Agent copy(DataMap reference) {
		return new Burglar(this, reference);
	}
	
}
